package org.robotlegs.base
{
	import flash.display.DisplayObjectContainer;
	import flash.events.Event;

	import org.robotlegs.core.IInjector;

	

public class ViewMapBase
{
	public function ViewMapBase(contextView:DisplayObjectContainer, injector:IInjector)
	{
		this.injector = injector;

		// change this at your peril lest ye understand the problem and have a better solution
		this.useCapture = true;

		// this must come last, see the setter
		this.contextView = contextView;
	}


	
	
	protected var _enabled:Boolean = true;

	protected var _contextView:DisplayObjectContainer;

	protected var injector:IInjector;

	protected var useCapture:Boolean;
	
	protected var viewListenerCount:uint;

	
	
	
	public function get contextView():DisplayObjectContainer{return _contextView;}
	public function set contextView(value:DisplayObjectContainer):void{if (value != _contextView)
	{
			removeListeners();
			_contextView = value;
			if (viewListenerCount > 0)
				addListeners();
		}
	}

	
	public function get enabled():Boolean{return _enabled;}
	public function set enabled(value:Boolean):void
	{
		if (value != _enabled)
		{
			removeListeners();
			_enabled = value;
			if (viewListenerCount > 0)
				addListeners();
		}
	}


	protected function addListeners():void
	{
	}


	protected function removeListeners():void
	{
	}


	protected function onViewAdded(e:Event):void
	{
	}
}
}
